<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>恒巨教育</title>
    <link rel="stylesheet" href="../utils/layui/css/layui.css" />
    <link rel="stylesheet" href="../utils/iconfont/iconfont.css">
    <!-- <link rel="stylesheet" href="../utils/css/pingFangFont.css"> -->
    <link rel="stylesheet" href="../css/style.css" />
</head>

<body>
    <!-- <iframe src="" width="100%" height="100%" scrolling="yes" class="listTop dn" id="newAswer"></iframe> -->
    <div class="pageRightContent" style="display: block">
        <!-- 班级列表 -->
        <div class="getOnCourseList" style="display: block">
            <div class="pageRightContentOne getClassHour">
                <span>当前班级：</span>
                <!-- <button id="addClassHourBtn" class="layui-btn domeBtn addClassHourBtn">添加</button> -->
            </div>
            <table class="pageRightContentTable" style="width: 100%;">
                <thead>
                    <th>编号</th>
                    <th>名称</th>
                    <!-- <th>课程时常</th>
                    <th>更新时间</th>
                    <th>操作</th> -->
                </thead>
                <tbody>
                    <!-- 生成课时列表 -->
                </tbody>
            </table>
        </div>
    </div>
</body>

</html>
<script src="../utils/js/jquery-3.3.1.min.js"></script>
<script src="../utils/layui/layui.all.js"></script>
<script>
    $(function () {
        var url = document.location.toString();
        var urlParmStr = url.slice(url.indexOf('?') + 1);
        var arr = urlParmStr.split('&');
        var id = arr[0].split("=")[1];
        var title = arr[1].split("=")[1];
        title = decodeURI(title);
        $('.pageRightContentOne span').append(title);
        // 获取课时列表
        var data = {
            t: "1559010885",
            r: "z2eG2RFma",
            z: "0E7E1911542C66EAA8081132D1CFDF5E",
            classroomId: id
        }
        $.ajax({
            url: 'http://www.zhenggod.com/admin/getCourseForClassroomeId',
            type: 'post',
            dataType: "json",
            contentType: "application/x-www-form-urlencoded",
            data: data,
            success: function (res) {
                console.log(res);
                let arr = [];
                let data = res.data;
                for (let i = 0; i <data.length; i++) {
                    let item =
                    `
                    <tr>
                        <td>${data[i].courseId}</td>
                        <td>${data[i].title}</td>
                    </tr>
                    `
                    arr.push(item)
                }
                $('.getOnCourseList tbody').html(arr)
            }
        })
    })
</script>